//
//  UIView+allSubviews.m
//  HX_GTS2
//
//  Created by GC_tandy on 2018/8/31.
//  Copyright © 2018年 gw. All rights reserved.
//
#import "UIView+allSubviews.h"

@implementation UIView (allSubviews)

- (NSArray *)subViewsOfMemberClass:(Class)class{
    
    if(self.subviews.count == 0)return nil;
    
    NSMutableArray *arrM = [NSMutableArray array];
    for (UIView *subView in self.subviews){
        NSArray *subArr = [subView subViewsOfMemberClass:class];
        if(subArr){
            [arrM addObjectsFromArray:subArr];
        }
        if([subView isMemberOfClass:class]){
            [arrM addObject:subView];
        }
    }
    return arrM;
}

@end



@implementation TJWeakReferenceObj

@end

@implementation TJWeakReferenceArrM

- (NSArray *)realReferenceArr{
    if(self.count == 0)return nil;
    NSMutableArray *arrM = [[NSMutableArray alloc]init];
    for(TJWeakReferenceObj *obj in self){
        if(obj.weakObj){
            [arrM addObject:obj.weakObj];
        }
    }
    [self removeAllObjects];
    [self addObjectsFromArray:arrM];
    if(arrM.count == 0)return nil;
    return arrM;
}

@end
